home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
obero
/
OberonAModules.lha
/
XpkMaster.mod
< prev
next >
Wrap
Text File
|
1999-02-26
|
16KB
|
397 lines
(*************************************************************************
:Program. XpkMaster.mod
:Contents. Interface-Module for xpkmaster.library
:Author. Hartmut Goebel [hG]
:Copyright. Copyright © 1991 by Hartmut Goebel
:Copyright. May be free dirstibuted with the Xpk-Package
:Copyright. permission is given to be inlcuded with AmigaOberon
:Language. Oberon
:Translator. Amiga Oberon V2.14
:History. V0.9, 08 Jan 1992 Hartmut Goebel [hG]
:History. V1.0, 04 Jun 1992 [hG]
:History. V1.1, 06 Jul 1992 [hG] remove "Xpk" from procname, because
:History. in Oberon you U must import qualified, so this is useless
:History. V1.1b 27 Jul 1992 [hG] XpkMasterNA build in
:History. V2.0 04 Aug 1992 [hG] adapted to Xpk 2.0
:Date. 04 Aug 1992 01:25:20
:Remark. compile with "set NoAssert" to generate XpkMasterNA, which
:Remark. does not asure the lib is opened successfull (you must check
:Remark. this by yourself then!)
Changed by Morten Bjergstrøm to work with Oberon-A (It didn't before)
Now your program won't quit if xpkmaster.library isn't available therefore
you have to check xpk.base before you use any xpk functions!
EMail: mbjergstroem@hotmail.com
*************************************************************************)
<*STANDARD-*>
MODULE [2] XpkMaster;
IMPORT
e := Exec,
I := Intuition,
s := SYSTEM,
u := Utility,
Kernel;
CONST
XpkName = "xpkmaster.library";
(*****************************************************************************
*
*
* The packing/unpacking tags
*
*)
(* Tags we support *)
tagBase * = u.user + ORD("X")*256 + ORD("P");
(* Caller must supply ONE of these to tell Xpk#?ackFile where to get data from *)
inName * = tagBase+01H; (* Process an entire named file *)
inFH * = tagBase+02H; (* File handle - start from current position *)
(* If packing partial file, must also supply InLen *)
inBuf * = tagBase+03H; (* Single unblocked memory buffer *)
(* Must also supply InLen *)
inHook * = tagBase+04H; (* Call custom Hook to read data *)
(* If packing, must also supply InLen *)
(* If unpacking, InLen required only for PPDecrunch *)
(* Caller must supply ONE of these to tell Xpk#?ackFile where to send data to *)
outName * = tagBase+10H; (* Write (or overwrite) this data file *)
outFH * = tagBase+11H; (* File handle - write from current position on *)
outBuf * = tagBase+12H; (* Unblocked buffer - must also supply OutBufLen *)
getOutBuf * = tagBase+13H; (* Master allocates OutBuf - ti_Data points to buf ptr *)
outHook * = tagBase+14H; (* Callback Hook to get output buffers *)
(* Other tags for Pack/Unpack *)
inLen * = tagBase+20H; (* Length of data in input buffer *)
outBufLen * = tagBase+21H; (* Length of output buffer *)
getOutLen * = tagBase+22H; (* ti_Data points to long to receive OutLen *)
getOutBufLen * = tagBase+23H; (* ti_Data points to long to receive OutBufLen *)
password * = tagBase+24H; (* Password for de/encoding *)
getError * = tagBase+25H; (* ti_Data points to buffer for error message *)
outMemType * = tagBase+26H; (* Memory type for output buffer *)
passThru * = tagBase+27H; (* Bool: Pass through unrecognized formats on unpack *)
stepDown * = tagBase+28H; (* Bool: Step down pack method if necessary *)
chunkHook * = tagBase+29H; (* Call this Hook between chunks *)
packMethod * = tagBase+2AH; (* Do a FindMethod before packing *)
chunkSize * = tagBase+2BH; (* Chunk size to try to pack with *)
packMode * = tagBase+2CH; (* Packing mode for sublib to use *)
noClobber * = tagBase+2DH; (* Don't overwrite existing files *)
ignore * = tagBase+2EH; (* Skip this tag *)
taskPri * = tagBase+2FH; (* Change priority for (un)packing *)
fileName * = tagBase+30H; (* File name for progress report *)
shortError * = tagBase+31H; (* Output short error messages *)
packersQuery * = tagBase+32H; (* Query available packers *)
packerQuery * = tagBase+33H; (* Query properties of a packer *)
modeQuery * = tagBase+34H; (* Query properties of packmode *)
lossyOK * = tagBase+35H; (* Lossy packing permitted? def.=no*)
findMethod * = packMethod; (* Compatibility *)
margin * = 256; (* Safety margin for output buffer *)
TYPE
(*****************************************************************************
*
*
* The hook function interface
*
*)
(* Message passed to InHook and OutHook as the ParamPacket *)
XpkIOMsgPtr * = POINTER TO XpkIOMsg;
XpkIOMsg * = RECORD
type * : LONGINT; (* Read/Write/Alloc/Free/Abort *)
ptr * : e.APTR; (* The mem area to read from/write to *)
size * : LONGINT; (* The size of the read/write *)
ioError * : LONGINT; (* The IoErr() that occurred *)
reserved * : e.ADDRESS; (* Reserved for future use *)
private1 * : e.ADDRESS; (* Hook specific, will be set to 0 by *)
private2 * : e.ADDRESS; (* master library before first use *)
private3 * : e.ADDRESS;
private4 * : e.ADDRESS;
END;
CONST
(* The values for XpkIoMsg.type *)
ioRead * = 1;
ioWrite * = 2;
ioFree * = 3;
ioAbort * = 4;
ioGetBuf * = 5;
ioSeek * = 6;
ioTotSize * = 7;
(*****************************************************************************
*
*
* The progress report interface
*
*)
TYPE
(* Passed to ChunkHook as the ParamPacket *)
XpkProgressPtr * = POINTER TO XpkProgress;
XpkProgress * = RECORD
type * : LONGINT; (* Type of report: start/cont/end/abort *)
packerName * : e.STRPTR; (* Brief name of packer being used *)
packerLongName * : e.STRPTR; (* Descriptive name of packer being used *)
activity * : e.STRPTR; (* Packing/unpacking message *)
fileName * : e.STRPTR; (* Name of file being processed, if available *)
cCur * : LONGINT; (* Amount of packed data already processed *)
uCur * : LONGINT; (* Amount of unpacked data already processed *)
uLen * : LONGINT; (* Amount of unpacked data already processed *)
cf * : LONGINT; (* Compression factor so far *)
done * : LONGINT; (* Percentage done already *)
speed * : LONGINT; (* Bytes per second, from beginning of stream *)
reserved * : ARRAY 8 OF e.ADDRESS; (* For future use *)
END;
CONST
(* The values for XpkProgress.type *)
progStart * = 1;
progMid * = 2;
progEnd * = 3;
(*****************************************************************************
*
*
* The file info block
*
*)
TYPE
XpkFibPtr * = POINTER TO XpkFib;
XpkFib * = RECORD
type * : LONGINT ; (* Unpacked, packed, archive? *)
uLen * : LONGINT ; (* Uncompressed length *)
cLen * : LONGINT ; (* Compressed length *)
nLen * : LONGINT ; (* Next chunk len *)
uCur * : LONGINT ; (* Uncompressed bytes so far *)
cCur * : LONGINT ; (* Compressed bytes so far *)
id * : ARRAY 4 OF s.BYTE ; (* 4 letter ID of packer *)
packer * : ARRAY 6 OF s.BYTE ; (* 4 letter name of packer *)
subVersion * : INTEGER ; (* Required sublib version *)
masVersion * : INTEGER ; (* Required masterlib version *)
flags * : SET ; (* Password? *)
head * : ARRAY 16 OF s.BYTE ; (* First 16 bytes of orig. file *)
ratio * : LONGINT ; (* Compression ratio *)
reserved * : ARRAY 8 OF e.ADDRESS; (* For future use *)
END;
XpkFH * = POINTER TO RECORD
fib*: XpkFib
(